<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>注册页</title>
		<style type="text/css">
			*{margin: 0;padding: 0;}
			body{
				background-image:url(./timg.jpg) ;
				background-size: cover;
			}
			h3{
				text-align: center;
			    margin-top: 100px;
				font-size: 20px;
				color: #0099CC;
			}
			.wrap{
				width: 500px;
				height: 200px;
				border: 1px solid #0000FF;
				margin: 100px auto;
				text-align: center;
			}
			h2{
				font-size: 20px;
				color: #0099CC;
			}
			hr{
				padding-top: 10px;
			}
			p{
				padding: 10px;
				color: #0099CC;
			}
			button{
				width: 50px;
				height: 24px;
				border-radius: 5px;
				color: #0099CC;
			}
		</style>
	</head>
	<body>
		<div class="wrap">
			<h2>注册页面</h2>
			<hr >
			<p>
				<label for="username">用户名：</label>
				<input type="text" name="" id="username" value="" />
			</p>
			<p>
				<label for="password">密码：</label>
				<input type="password" name="" id="password" value="" placeholder="请输入密码"/>
			</p>
			<p>
				<label for="repassword">确认密码：</label>
				<input type="password" name="" id="repassword" value="" />
			</p>
			<p>
				<label for="name">姓名：</label>
				<input type="text" name="" id="name" value="" placeholder="请输入真实姓名"/>
			</p>
			<p><button type="button" id="send">注册</button></p>
		</div>
		<script src="../jquery.min.js"></script>
		<script src="common.js"></script>
		<script type="text/javascript">
			$("#send").click(function(){
				let username=$("#username").val();
				let password=$("#password").val();
				let name=$("#name").val();
				if(username && password && name){
					$.ajax({
								url:"${address}/register",
								method:"get",
								data:{
									username,
									password,
									name
								},
								success(data){
									if(data ==="error"){
										alert("用户名或密码错误")
									}
									else{
										alert("注册成功")
									}
								}
							})
				}
					})
					
		</script>
	</body>
</html>
